.draggable-container {
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    background-color: #f5f5f5;
}
.title {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}
.control-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}
.control-btn.add-swiper {
    background-color: #4287f5;
}
.control-btn.add-text {
    background-color: #f5a642;
}
.control-btn.add-image {
    background-color: #42b983;
}
.control-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.grid-container {
    position: relative;
    width: 90%;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.grid-background {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
    width: 100%;
}
.grid-cell {
    aspect-ratio: 146.5 / 90;
    border-radius: 6px;
    background: #f8fbff;
    border: 1px dashed #c3d4f2;
    transition: background 0.2s;
}
.grid-cell:hover {
    background: #f0f7ff;
}
.draggable-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.component-content {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 10px;
    background-color: rgba(66, 185, 131, 0.8);
    color: white;
    border-radius: 6px;
    overflow: hidden;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
}
.component-content:hover {
    background-color: rgba(66, 185, 131, 0.9);
}
.component-header {
    font-weight: bold;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 5px;
    flex-shrink: 0; /* 标题不收缩 */
}
.component-body {
    flex-grow: 1; /* 内容区域占满剩余空间 */
    width: 100%;
    height: 0; /* 让flex布局决定实际高度 */
    overflow: hidden;
}

/* 图片组件样式 */
.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.image-icon {
    font-size: clamp(20px, 10vw, 60px); /* 响应式图标大小 */
    transition: transform 0.3s;
}
.component-content:hover .image-icon {
    transform: scale(1.05);
}

/* 文本组件样式 */
.text-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
}

/* 拖拽组件样式 */
::v-deep .vue3-draggable-resizable.active {
    box-shadow: 0 0 0 2px #42b983;
    z-index: 10;
}
::v-deep .vue3-draggable-resizable-handle {
    width: 12px;
    height: 12px;
    background-color: white;
    border: 1px solid #42b983;
}
::v-deep .vue3-draggable-resizable-moving {
    display: none;
}

/* 轮播组件样式 */
::v-deep .t-swiper {
    width: 100%;
    height: 100%;
}
::v-deep .t-swiper-item {
    width: 100%;
    height: 100%;
}

.snap-guide {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: #42b983;
    z-index: 50;
    pointer-events: none;
}

.component-header {
    font-weight: bold;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 5px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 删除按钮样式 */
.delete-btn {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 16px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-btn:hover {
    background-color: rgba(255, 69, 0, 0.7);
}

/* 优化：吸附线支持Y轴 */
.snap-guide-x {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background-color: #42b983;
    z-index: 50;
    pointer-events: none;
}

.snap-guide-y {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #42b983;
    z-index: 50;
    pointer-events: none;
}

/* 优化：选中态强化（添加边框+阴影） */
::v-deep .vue3-draggable-resizable.active {
    box-shadow: 0 0 0 2px #42b983, 0 4px 12px rgba(66, 185, 131, 0.3);
    z-index: 10;
    border-radius: 6px;
}

/* 优化：禁用拖拽时的文本选中 */
.draggable-area {
    user-select: none;
    -webkit-user-select: none;
}
/* 卡片样式调整 */
.component-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    margin: 0;
    border-radius: 6px;
    overflow: hidden;
}

/* 头部内容布局 */
.card-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* 组件类型文本 */
.component-type {
    font-weight: 500;
    color: #111827;
}

/* 删除按钮调整 */
.delete-btn {
    color: #ff4d4f;
    padding: 0 4px;
    margin-left: 8px;
}

.delete-btn:hover {
    background-color: rgba(255, 77, 79, 0.1);
}

/* 主体内容区域 */
.component-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    width: 100%;
    height: calc(100% - 24px); /* 减去头部高度 */
    align-items: center;
    justify-content: center;
}

/* 选中状态强化 */
::v-deep .component-card.t-card--shadow-hover {
    border-color: #4e5969;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.component-library {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.component-item {
    padding: 12px 16px;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.component-item:hover {
    background-color: #fafafa;
    border-color: #c9cdd4;
    transform: translateY(-1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
